home *** CD-ROM | disk | FTP | other *** search
- # DESCRIPTION:
- # --------------------------------------------------------------
- #
- # open and switch through all valid states for cdda in three
- # different processes, only one sound device, one cd with da disc
- # installed, will involve resource contention for sound device and
- # cd, include masteraudio set/query for each process.
- # [switch mode each device[switch state each device]].
- #
- # --------------------------------------------------------------
- #
- @PROCESSES=2
- @EVENTS={THREAD1=1,THREAD2=0,BREAKPOINT=0}
- #
- defaultconnection cdaudio00 make type cd stream to ampmix totype amp stream wait
- #
- @PROCESS 1
- @BREAK A CDDA WILL NEED TO BE IN THE DEFAULT CD-ROM
- @SET_EVENT BREAKPOINT 1
- ;
- ; set masteraudio level for session to 80% - will affect both
- ; processes
- ;
- masteraudio volume 80 wait
- ;
- ; open cdaudio device non-exclusively
- ;
- open cdaudio00 alias cdda1 shareable notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_OPEN #1
- @WAIT_NOTIFY 1
- @WAIT_NOTIFY 21 30000
- ;
- ; no way of knowing which open (in which process) was the last
- ; to complete. All opens were non-exclusive. Need to do an
- ; acquire to make sure process 1 has the active instance
- ;
- acquire cdda1 wait
- @WAIT_PASSDEVICE cdda1 30000
- ;
- ; set cd to streaming mode
- ;
- connector cdda1 enable type cd stream notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #2
- @WAIT_NOTIFY 2 30000
- ;
- ; cue cd for play
- ;
- cue cdda1 output notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CUE #3
- @WAIT_NOTIFY 3 30000
- ;
- ; play cd asynchronously
- ;
- play cdda1
- @PAUSE 2000
- ;
- ; close cd device instance
- ;
- close cdda1 wait
- ;
- ; open another cd device instance non-exclusively
- ;
- open cdaudio00 alias cdda1_1 shareable wait
- acquire cdda1_1
- @WAIT_PASSDEVICE cdda1_1
- ;
- ; set cd to streaming mode
- ;
- connector cdda1_1 enable type cd stream wait
- ;
- ; cue cd for play
- ;
- cue cdda1_1 output wait
- ;
- ; play cd for 5 seconds
- ;
- play cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
- @PAUSE 5000
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- @WAIT_EVENT THREAD1
- ;
- ; recover control of resource (cd device/acpa) from process 3.
- ;
- ; recover exclusive control of resource (cd device/acpa) from
- ; process 3
- ;
- acquire cdda1_1 exclusive notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #6
- @WAIT_NOTIFY 6 30000
- @WAIT_PASSDEVICE cdda1_1 30000
- @PAUSE 5000
- ;
- ; release exclusive control of resource
- ;
- release cdda1_1 wait
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- @WAIT_EVENT THREAD1 45000
- ;
- acquire cdda1_1 wait
- @WAIT_PASSDEVICE cdda1_1 30000
- #
- stop cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #8
- @WAIT_NOTIFY 8 30000
- ;
- ; seek to start of first track on CD
- ;
- seek cdda1_1 to start notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #10
- @WAIT_NOTIFY 10 30000
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- @WAIT_EVENT THREAD1 45000
- ;
- ; recover control of resource (cd device/acpa) from process 3
- ;
- acquire cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #11
- @WAIT_NOTIFY 11 30000
- @WAIT_PASSDEVICE cdda1_1 30000
- ;
- ; disable cd stream connector
- ;
- connector cdda1_1 disable type cd stream notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #12
- @WAIT_NOTIFY 12 30000
- ;
- ; play cd. No connectors enabled so play is invalid
- ;
- play cdda1_1 notify
- =!ERROR
- ;
- ; enable headphones (default) connector
- ;
- connector cdda1_1 enable type headphones wait
- ;
- ; play in non-streaming mode for 3 seconds
- ;
- play cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
- @PAUSE 3000
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- @WAIT_EVENT THREAD1 45000
- ;
- ;
- ; recover exclusive control of resource (cd device) from process 3
- ;
- acquire cdda1_1 exclusive notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #16
- @WAIT_NOTIFY 16 30000
- @WAIT_PASSDEVICE cdda1_1 30000
- ;
- ; stop play
- ;
- stop cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #17
- @WAIT_NOTIFY 17 30000
- ;
- ; release exclusive control of resource (cd device) from process 3
- ;
- release cdda1_1 wait
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- @WAIT_EVENT THREAD1 45000
- ;
- ; instance is inactive. Do some statuses
- ;
- status cdda1_1 time format wait
- =mmtime
- ;
- status cdda1_1 ready wait
- =true
- ;
- ; close cd instance for process 1 (cd1_1)
- ;
- close cdda1_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CLOSE #20
- @WAIT_NOTIFY 20 30000
- ;
- @SET_EVENT THREAD1 0
- @SET_EVENT THREAD2 1
- ;
- ;
- @PROCESS 2
- @WAIT_EVENT BREAKPOINT
- ;
- ; open a non-exclusive cdaudio instance for process 2
- ;
- open cdaudio00 alias cdda2 shareable notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_OPEN #21
- ;
- @WAIT_EVENT THREAD2
- ;
- ; query the session masteraudio setting. Remember process 1
- ; changed it to 80%. Now change it to 50%
- ;
- masteraudio query volume wait
- =80
- masteraudio volume 50 wait
- masteraudio query volume wait
- =50
- ;
- acquire cdda2 wait
- @WAIT_PASSDEVICE cdda2 30000
- #
- connector cdda2 enable type cd stream notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #22
- @WAIT_NOTIFY 22 30000
- ;
- ; change time format to track-minutes-seconds-frames format
- ;
- set cdda2 time format tmsf wait
- ;
- ; seek to track 3
- ;
- seek cdda2 to 3 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #23
- @WAIT_NOTIFY 23 30000
- ;
- ; play asynchronously for 3 seconds
- ;
- play cdda2
- @PAUSE 3000
- ;
- ; close device instance
- ;
- close cdda2 wait
- ;
- ; open cdaudio device instance non-exclusively
- ;
- open cdaudio00 alias cdda2_1 shareable wait
- ;
- ; change time format to track-minutes-seconds-frames format
- ;
- acquire cdda2_1
- @WAIT_PASSDEVICE cdda2_1 30000
- ;
- set cdda2_1 time format tmsf wait
- ;
- ; enable cd stream connector
- ;
- connector cdda2_1 enable type cd stream wait
- ;
- ; cue for play
- ;
- cue cdda2_1 output wait
- ;
- ; play for 3 seconds
- ;
- play cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
- @PAUSE 3000
- ;
- @SET_EVENT THREAD2 0
- @SET_EVENT THREAD1 1
- @WAIT_EVENT THREAD2 45000
- ;
- ; recover control from process 1
- ;
- acquire cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #24
- @WAIT_NOTIFY 24 30000
- @WAIT_PASSDEVICE cdda2_1 30000
- #
- pause cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_PAUSE #25
- @WAIT_NOTIFY 25 30000
- ;
- @SET_EVENT THREAD2 0
- @SET_EVENT THREAD1 1
- @WAIT_EVENT THREAD2 45000
- ;
- ; recover control from process 1
- ;
- acquire cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #26
- @WAIT_NOTIFY 26 30000
- @WAIT_PASSDEVICE cdda2_1 30000
- ;
- ; resume play for 3 seconds
- ;
- resume cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_RESUME
- @PAUSE 2000
- ;
- @SET_EVENT THREAD2 0
- @SET_EVENT THREAD1 1
- @WAIT_EVENT THREAD2 45000
- ;
- ; recover control from process 1
- ;
- acquire cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #29
- @WAIT_NOTIFY 29 30000
- @WAIT_PASSDEVICE cdda2_1 30000
- #
- seek cdda2_1 to start notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #30
- @WAIT_NOTIFY 30 30000
- ;
- acquire cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #31
- @WAIT_NOTIFY 31 30000
- @WAIT_PASSDEVICE cdda2_1 30000
- #
- connector cdda2_1 disable type cd stream notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CONNECTOR #32
- @WAIT_NOTIFY 32 30000
- ;
- ; no connections now. Need to re-enable headphones connector,
- ; asynchronously
- ;
- connector cdda2_1 enable type headphones
- @PAUSE 2000
- ;
- ; play for 3 seconds
- ;
- play cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_ABORTED MCI_PLAY
- @PAUSE 3000
- ;
- #
- stop cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_STOP #37
- @WAIT_NOTIFY 37 30000
- ;
- status cdda2_1 time format wait
- =tmsf
- ;
- @SET_EVENT THREAD2 0
- @SET_EVENT THREAD1 1
- @WAIT_EVENT THREAD2 45000
- #
- acquire cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_ACQUIREDEVICE #38
- @WAIT_NOTIFY 38 30000
- @WAIT_PASSDEVICE cdda2_1 30000
- #
- seek cdda2_1 to end notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_SEEK #39
- @WAIT_NOTIFY 39 30000
- ;
- ; close cd device instance for this process
- ;
- close cdda2_1 notify
- +MM_MCINOTIFY MCI_NOTIFY_SUCCESSFUL MCI_CLOSE #40
- @WAIT_NOTIFY 40 30000
- ;
- @SET_EVENT THREAD2 0
- @SET_EVENT THREAD1 1
- ;
- ;
-